package com.medical.literature.test;

import org.springframework.web.reactive.function.client.WebClient;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

public class TestLogin {
    public static void main(String[] args) {
        WebClient client = WebClient.create();
        
        // 准备登录数据
        MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
        formData.add("username", "admin");
        formData.add("password", "123456");
        
        // 发送登录请求到API网关
        String response = client.post()
                .uri("http://localhost:10003/user-service/auth/login")
                .contentType(MediaType.APPLICATION_FORM_URLENCODED)
                .bodyValue(formData)
                .retrieve()
                .bodyToMono(String.class)
                .block();
        
        System.out.println("登录响应: " + response);
    }
}